<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base target="_self">
    <title>新增货物</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="新增,货物">
	<meta http-equiv="description" content="This is my page">

	<style type="text/css">
	</style>

  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="" namespace="">
    		<jsp:include page="/jsp/outward/business/common/menuLink.jsp">
    			<jsp:param name="menuLink" value="[{'name':'货存管理'},{'name':'货存物品'},{'name':'新增货物'}]"/>
    			<jsp:param name="width" value="70%"/>
    		</jsp:include>
    		
    		<s:hidden name="kindergartenId" id="kindergartenId"></s:hidden>
    		
    		<table width="100%" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
    			<tr bgcolor="#FFFFFF">
    				<td width="20%" align="right" class="label">
    					名称：
    					<br>
    					<font color="red">(20字以内)</font>
    				</td>
    				<td width="30%" align="left">
    					<s:textfield name="stockObj.objName" id="objName" cssStyle="width:90%" maxlength="20"></s:textfield>
    				</td>
    				<td width="20%" align="right" class="label">
    					单价(￥)：
    					<br>
    					<font color="red">(10字以内)</font>
    				</td>
    				<td width="30%" align="left">
    					<s:textfield name="stockObj.price" id="price" cssStyle="width:90%" maxlength="10"></s:textfield>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					库存：
    				</td>
    				<td align="left">
    					<s:textfield name="stockObj.stockCount" id="stockCount" cssStyle="width:90%" maxlength="10"></s:textfield>
    				</td>
    				<td align="right" class="label">
    					单位：
    				</td>
    				<td align="left">
    					<s:textfield name="stockObj.unit" id="unit" cssStyle="width:90%" maxlength="10"></s:textfield>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					对应指标：
    				</td>
    				<td align="left">
    					<s:select name="stockObj.chargeIndex.id" id="ciId" list="indexList" listKey="id" listValue="indexName" headerKey="" headerValue="--请选择--" cssStyle="width:120px"></s:select>
    				</td>
    				<td align="right" class="label">
    					所属幼儿园：
    				</td>
    				<td align="left">
    					<s:select name="whickKinder" id="whickKinder" list='#{"this":"本园", "all":"全部"}' cssStyle="width:100px"></s:select>
    				</td>
    			</tr>
    		</table>
    		
    		<table width="100%" cellspacing="0">
    			<tr>
    				<td align="center" valign="bottom" height="30">
    					<input type="button" value="新增" class="btn" onclick="addStockObj()" />
    				</td>
    			</tr>
    		</table>
    		
    		
    	</s:form>
    </center>
    
    <script type="text/javascript">
    function addStockObj()
    {
    	var objName = $('#objName');
    	var price = $('#price');
    	var stockCount = $('#stockCount');
    	var unit = $('#unit');
    	if(!isNotNull(objName.val()))
    	{
    		showMsg('名称不能为空。', function(){objName.focus();});
    		return;
    	}
    	if(!isNotNull(price.val()))
    	{
    		showMsg('单价不能为空。', function(){price.focus();});
    		return;
    	}
    	if(!isNotNull(stockCount.val()))
    	{
    		showMsg('库存不能为空。', function(){stockCount.focus();});
    		return;
    	}
    	if(!isNotNull(unit.val()))
    	{
    		showMsg('单位不能为空。', function(){unit.focus();});
    		return;
    	}
    	if(checkFloat(price) == false)
    	{
    		showMsg('单价有误。', function(){price.focus();});
    		return;
    	}
    	if(checkFloat(stockCount) == false)
    	{
    		showMsg('库存有误。', function(){stockCount.focus();});
    		return;
    	}
    	
    	var url = 'inner/stock/addStockObj.action';
    	ajaxAction(url, 'post', 'frm', false, function(){
    		window.opener.searchThis();
    		window.close();
    	});
    }
    </script>
  </body>
</html>
